package com.hdsf.base.file.io;

import java.io.File ;
import java.io.FileInputStream ;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.zip.ZipEntry ;  
import java.util.zip.ZipInputStream ;   
public class SingleFileUnzip{  
    public static void main(String args[]) throws Exception{     
        //????????, ?????zip?????????????????????java??
    	File zipFile = new File("c:/temp/single.zip") ;   // ??????????????          
        ZipInputStream input = null ;   // ?????????????  
        input = new ZipInputStream(new FileInputStream(zipFile)) ;  // ?????ZIpInputStream  
        ZipEntry entry = input.getNextEntry() ; // ????????????  
        System.out.println("???????????" + entry.getName()) ;  //????????????????? 
        
        //????????????????????????????????????java????
        File outFile = new File("c:/temp/" + entry.getName());
        OutputStream out = new FileOutputStream(outFile) ;   // ?????????????  
        int temp = 0 ;  
        while((temp=input.read())!=-1){  
            out.write(temp) ;  
        }  
        input.close() ;     // ?????????  
        out.close() ;   // ????????
        System.out.println("unzip done.") ;
    }  
}
